package com.young.javasist

import com.android.build.gradle.AppExtension
import com.android.build.gradle.BaseExtension
import org.gradle.api.Plugin
import org.gradle.api.Project

public class ModifyPlugin implements Plugin<Project>{

    @Override
    void apply(Project target) {
        // 参考：https://github.com/yubo725/android-transform-demo/blob/master/buildSrc/src/main/java/com/test/plugin/MyPlugin.java
        BaseExtension ext = target.getExtensions().findByType(BaseExtension.class);
        if (ext != null) {
            ext.registerTransform(new ModifyTransform(target))
        }
//        AppExtension appExtension = (AppExtension)project.getProperties().get("android");
//        appExtension.registerTransform(new ModifyTransform(project), Collections.EMPTY_LIST);
    }
}